<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="lushu">
		<title>手工补消费</title>
		<script language="javascript" src="../script/common.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
			var form,amountValidator;
			var org = Common.cOrg();	//当前单位
			function load(){
				Eui.showNavigation();
				form = $('tradeForm');
				form.reset();
				$("tradeTimeTd").innerHTML = Eui.getDateInput("交易时间","tradeForm","occurTime","dateTime",true,true);
				Common.initDict(form.accCode,TX.AccountType.cardTx());
				onAccCodeChanged();
				setPages(["tradeForm","printSheetDiv"]);
			}
			function onAccCodeChanged(){
				var unit = (Common.getItem('account_type',form.accCode.value))["unit"];
				var text = Common.getText("account_unit",unit);
				$("unit").innerHTML = text;
				$("unit2").innerHTML = text;
				amountValidator = Account.getValidatorByUnit(unit,true);
			}
			//补消费方法
			function repairConsumption(){
				if(!checkForm('tradeForm'))
					return;
				try{
					var result = DWR.syncCall("cardTxService.manualAddConsume",
										form.asn.value,
										Account.valueInByAccCode(form.accCode.value,form.balance.value),
										Account.valueInByAccCode(form.accCode.value,form.amount.value),
										form.accCode.value,
										form.orgUniqueId.value,
										form.occurTime.value,
										form.terminalNo.value,
										form.psamTradeNo.value,
										form.tac.value,
										form.eftNo.value,
										form.epsSn.value
											)
					showInformation("补消费成功");
					switchPage("printSheetDiv");
					
//					TX.Trade.showResult(result);
				}catch(e){
					showError(e.description)
				}
				
			}
		function onBack(){
			form.reset()
			switchPage("tradeForm");
		}	
		
			
		</script>
	</head>
	<body onload="load()">
		<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<div id="detview" align="center">
		<form id="tradeForm" name="tradeForm">
			<div class="form">
				<div class="formTitle">消费数据</div>
				<table cellSpacing="0" cellPadding="4" width="100%" border="0" id = "reversalTable" class="col2 label7">
					<tr>
						<td>
							<label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> 
							<input type="text" name="asn" maxlength="16" onblur="checkV(this,'asn',true)"><span class="des">*</span>
						</td>	
						<td>
							<label>帐户类型</label> 
							<select name="accCode" onchange="onAccCodeChanged()"><option></option></select><span class="des">*</span>
						</td>
					</tr>
					<tr>
						<td>
							<label>消费额(<span id="unit"></span>)</label> 
							<input type="text" name="amount" onblur="amountValidator(this)"><span class="des">*</span>
						</td>
						<td>
							<label>帐户余额(<span id="unit2"></span>)</label> 
							<input type="text" name="balance" onblur="amountValidator(this)"><span class="des">*</span>
						</td>
					</tr>
					<tr>
						<td><label>受理机构编号</label> <input type="text" name="orgUniqueId" onblur="return;checkV(this,'uniqueId',true)"><span class="des">*</span></td>
						<td><label>T&nbsp;&nbsp;A&nbsp;&nbsp;C</label> <input type="text" name="tac" maxlength="8"><span class="des">*</span></td>
					</tr>
					<tr>
						<td><label>终端编号</label> <input type="text" name="terminalNo" maxlength="12" onblur="checkV(this,'long',true)"><span class="des">*</span></td>
						<td><label>终端流水号</label> <input type="text" name="psamTradeNo" maxlength="9" onblur="checkV(this,'int',true)"><span class="des">*</span></td>
					</tr>
					<tr>
						<td><label>EFT 编号</label> <input type="text" name="eftNo" maxlength="9" onblur="checkV(this,'long',true)"><span class="des">*</span></td>
						<td><label>EPS 交易序列号</label> <input type="text" name="epsSn" maxlength="9" onblur="checkV(this,'long',true)"><span class="des">*</span></td>
					</tr>
					<tr>
					<td id="tradeTimeTd">&nbsp;</td>
					</tr>
				</table>
			</div>
				<p>
					<button id="rcBtn" onclick="repairConsumption()">补消费</button>
				</p>
		</form>
	</div>
	<div id="printSheetDiv" style="display:none;">
		<div class="form">
			<div class="formTitle">补消费明细</div>
			<div id="mainTrade"></div>
		</div>
		<p>
			<button onclick="onBack()">返 回</button>
		</p> 
	</div>
	</body>
</html>